Skip to content

sofa-pbrpc protobuf v3支持#102

Open
zd-double wants to merge 6 commits intobaidu:masterfrom
zd-double:pb3-branch
Open

sofa-pbrpc protobuf v3支持#102
zd-double wants to merge 6 commits intobaidu:masterfrom
zd-double:pb3-branch

Conversation

@zd-double
Copy link
Collaborator

实现方案

  1. 在src/sofa/pbrpc/分别增加proto2 proto3的目录,存放不同版本的pb对应的sofa-pbrpc内置proto。
  2. 在depends.mk中通过参数PROTO_VERSION控制编译pb的版本,代码中通过SOFA_PBRPC_USE_PROTO3的宏进行条件编译。默认采用pb2的版本编译pb,当编译时指定PROTO_VERSION=proto3,Makefile增加DSOFA_PBRPC_USE_PROTO3的选项,采用pb3的版本编译pb。
  3. 在sample 和 test分别增加proto2 proto3目录,通过PROTO_VERSION控制编译pb的版本。用户在应用程序中,编译选项引入SOFA_PBRPC_USE_PROTO3使用pb3的版本。

@zd-double
Copy link
Collaborator Author

@qinzuoyan @cyshi 辛苦左言,承毅看一下sofa-pbrpc兼容pb3的pr,谢谢!

// In protobuf v3 default option is not support.
// For numeric types, the default value is zero.
// set timeout_in_ms to 10 seconds when service_timeout equal to zero.
timeout_in_ms = 10000;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

之前proto2中的default value 是不是可以找地方统一初始化一次

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants